import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate"
import router from '../router'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    // baseUrl:'http://192.168.2.28:6060',
    baseUrl:'',
    userInfo: '',
    subLoading: false,
  },
  mutations: {
    setUser: (state, payload) => {
      state.userInfo = payload
    },
    setSubLoading: (state, payload) => {
      state.subLoading = payload
    },
    jumpLogin: (state, payload) => {
      router.push('/login')
    },
  },
  actions: {

  },
  modules: {},
  plugins: [createPersistedState({
    storage: window.sessionStorage
  })]
})